﻿<cfsilent>
	<cfscript>
	
		event.setArg("pageTitle", "教学任务安排 - 设置通选课任务");

		propAdvice = getProperty("serviceFactory").getBean("taskPropertyAdvice");

		targetArgs = structNew();
		rs_taskEntity = queryNew("tsk_id");

		termID = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
	
		courseID = event.getArg("CID");
		
		sql = "SELECT 
					t_course.cat_id, 
					t_course.institute_id, 
					t_course.cid, 
					t_institute.institute_name, 
					t_course.course_name, 
					t_course.period, 
					t_course.period_theory, 
					t_course.period_practice, 
					t_course.period_computer, 
					t_course.course_credit, 
					t_course.period_week 
				FROM 
					t_course 
					INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
				WHERE 
					t_course.cid = :courseId ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="courseId", value=courseID, cfsqltype="cf_sql_varchar" );
		rs_courseEntity = queryObj.execute( sql=sql ).getResult(); 

		sql = "SELECT 
					t_common_task.tsk_id, 
					t_common_task.cidx, 
					t_teacher.tch_name, 
					t_common_task.task_week, 
					t_common_task.task_period, 
					t_common_task.task_limite, 
					t_campus.campus_name, 
					t_classroom_type.cr_type_name, 
					t_common_task.task_prop 
				FROM 
					t_common_task 
					INNER JOIN t_teacher ON t_teacher.tch_id = t_common_task.tch_id 
					INNER JOIN t_campus ON t_campus.campus_id = t_common_task.campus_id 
					INNER JOIN t_classroom_type ON t_classroom_type.cr_type = t_common_task.cr_type 
				WHERE 
					t_common_task.term_id = :term 
					AND 
					t_common_task.cid = :course 
				ORDER BY 
					t_common_task.cidx DESC ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="term", value=termID, cfsqltype="cf_sql_char" );
		queryObj.addParam( name="course", value=courseID, cfsqltype="cf_sql_varchar" );
		rs_task = queryObj.execute( sql=sql ).getResult(); 
	
		sql = "SELECT 1
				FROM t_common_task 
				WHERE 
					SUBSTR(task_prop, 1, 1) = '1' 
					AND 
					term_id = :term 
					AND 
					cid = :course ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="term", value=termID, cfsqltype="cf_sql_char" );
		queryObj.addParam( name="course", value=courseID, cfsqltype="cf_sql_varchar" );
		rs_coursekLockCheck = queryObj.execute( sql=sql ).getResult();  

		sql = "SELECT cr_type, cr_type_name 
				FROM t_classroom_type 
				ORDER BY cr_type ";
		queryObj = new query( datasource=application.dnsSlave );
		rs_clsroomType = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT campus_id, campus_name 
				FROM t_campus 
				ORDER BY campus_id ";
		queryObj = new query( datasource=application.dnsSlave );
		rs_campus = queryObj.execute( sql=sql ).getResult();
		
		currentTab = event.getArg("TabID", "labTaskClass");
		
		if ( listLen(event.getArg("TaskID"), ",") eq 3 ) {
		
			currentTab = "labTaskDetail";
			
			sql = "SELECT 
						t_common_task.tsk_id, 
						t_teacher.tch_id, 
						t_common_task.task_limite, 
						t_common_task.task_chooesd, 
						t_common_task.task_week, 
						t_common_task.task_period, 
						t_teacher.tch_name, 
						t_common_task.cr_type, 
						t_common_task.campus_id, 
						t_common_task.task_desc 
					FROM 
						t_common_task 
						INNER JOIN t_teacher ON t_teacher.tch_id = t_common_task.tch_id 
					WHERE 
						t_common_task.tsk_id = :taskId ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="taskId", value=event.getArg("TaskID"), cfsqltype="cf_sql_varchar" );
			rs_taskEntity = queryObj.execute( sql=sql ).getResult(); 
		
		}
		
		limiteB2 = event.getArg("TASK.LIMITE.B2", 3);
		
		maxTask = limiteB2 - rs_task.recordCount;
		
		if ( rs_courseEntity.cat_id eq "S3" ) {

			limiteS3 = event.getArg("TASK.LIMITE.S3", 1);

			maxTask = limiteS3 - rs_task.recordCount;
		}
	
		structInsert(targetArgs, "DepID", rs_courseEntity.institute_id);
		structInsert(targetArgs, "CID", rs_courseEntity.cid);
	
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('commonTask', targetArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">任课单位 <cfoutput>#rs_courseEntity.institute_name#</cfoutput></span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 course"></i>通选课任务 《<cfoutput>#rs_courseEntity.course_name#</cfoutput>》
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labTaskClass">class="active"</cfif> id="labTaskClass" tabTarget="TaskClass">教学任务</span>
						<cfif event.isArgDefined("TaskID")>
							<span <cfif currentTab eq "labTaskDetail">class="active"</cfif> id="labTaskDetail" tabTarget="TaskDetail">任务详细信息</span>
						</cfif>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="TaskClass" class="tabContent">
					
					<cfif rs_courseEntity.recordCount>
						<div class="noticeBlock">
							<h3>《
								<cfoutput>#rs_courseEntity.course_name#</cfoutput>
								》 任课单位:
								<cfoutput>#rs_courseEntity.institute_name#</cfoutput>
							</h3>
							<p><span class="img icon16x16 message"></span>总学时 <em>
								<cfoutput>#rs_courseEntity.period#</cfoutput>
								</em>, 其中理论学时<em>
								<cfoutput>#rs_courseEntity.period_theory#</cfoutput>
								</em>, 实践学时<em>
								<cfoutput>#rs_courseEntity.period_practice#</cfoutput>
								</em>, 上机学时<em>
								<cfoutput>#rs_courseEntity.period_computer#</cfoutput>
								</em>. 课程总学分:<em>
								<cfoutput>#numberFormat(rs_courseEntity.course_credit, '_.00')#</cfoutput>
								</em></p>
							<hr/>
						</div>
					</cfif>
					
					<cfif rs_task.recordCount>

						<table id="taskClassList" class="UIEditable">
							<thead>
								<tr>
									<td width="18"></td>
									<td width="40">课序号</td>
									<td >教师</td>
									<td width="50">周次</td>
									<td width="40">周学时</td>
									<td width="48">计划人数</td>
									<td width="50">校区</td>
									<td width="60">教室类别</td>
									<td width="18"></td>
								</tr>
							</thead>
							<tbody>
                                <cfloop query="rs_task">
									<cfset structInsert(targetArgs, "TaskID", rs_task.tsk_id, true) />
									<cfset propAdvice.parseProperty(rs_task.task_prop) />
									<tr class="editRows">
										<td><cfif propAdvice.getLocked()><span class="stat locked"></span><cfelse><a href="<cfoutput>#buildURL('commonTaskRemoveDo', targetArgs)#</cfoutput>" class="stat delete"></a></cfif></td>
										<td><span class="numeric"><cfoutput>#rs_task.cidx#</cfoutput></span></td>
										<td><cfoutput>#rs_task.tch_name#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_week#</cfoutput></span></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_period#</cfoutput></span></td>
										<td><span class="numeric"><cfoutput>#rs_task.task_limite#</cfoutput></span></td>
										<td><cfoutput>#rs_task.campus_name#</cfoutput></td>
										<td><cfoutput>#rs_task.cr_type_name#</cfoutput></td>
										<td><cfif not propAdvice.getLocked()><cfif (rs_taskEntity.recordCount GT 0) and rs_taskEntity.tsk_id eq rs_task.tsk_id><span class="stat config"></span><cfelse><a href="<cfoutput>#buildURL('commonTaskByCourse', targetArgs)#</cfoutput>" class="stat edit"></a></cfif></cfif></td>
									</tr>
								</cfloop>
							</tbody>
						</table>	
						
					</cfif>
					<cfif maxTask gt 0>
						
						<cfif rs_coursekLockCheck.recordCount EQ 0>
							
							<div id="formBox">
						
								<form id="formCreate" onSubmit="javascript:return processCreate();" class="formWrapper" method="post" action="<cfoutput>#buildURL('commonTaskCreateDo')#</cfoutput>">
									<input type="hidden" name="CourseID" value="<cfoutput>#rs_courseEntity.cid#</cfoutput>" />
									<input type="hidden" name="TermID" value="<cfoutput>#termID#</cfoutput>" />
									<input type="hidden" id="TeacherID" name="TeacherID" value="<cfoutput>#event.getArg('TID')#</cfoutput>" />
									<div class="label">
										<span class="req">*</span><b>计划人数</b>
										<input name="PlanSize" type="text" class="typeSmallInt" verification="integer" maxlength="5" value="" />
										x
										<input name="TaskCount" id="TaskCount" type="text" class="typeCharInt" verification="integer" maxlength="1" value="<cfoutput>#maxTask#</cfoutput>" />
										个教学班
										<p class="notice">对于全校通选课通常会有一门课程重复开设的情况, 在这里您可以同时创建多个重复的教学任务.</p>
									</div>
									<hr/>
									<div class="label">
										<b>排课教室类别</b>
										<select name="ClassroomType">
                                            <cfloop query="rs_clsroomType">
												<option value="<cfoutput>#rs_clsroomType.cr_type#</cfoutput>"><cfoutput>#rs_clsroomType.cr_type_name#</cfoutput></option>
											</cfloop>
										</select>
									</div>
									<div class="label">
										<b>上课校区</b>
										<select name="CampusID">
                                            <cfloop query="rs_campus">
												<option value="<cfoutput>#rs_campus.campus_id#</cfoutput>"><cfoutput>#rs_campus.campus_name#</cfoutput></option>
											</cfloop>
										</select>
									</div>
									<div class="label">
										<b>排课设置</b> 
										<cfswitch expression="#rs_courseEntity.period_week#">
											<cfcase value="0">
												<p>不排课</p>
												<input name="TaskPeriod" type="hidden" value="0" />
												<input name="WeekStart" type="hidden" value="1" />
												<input name="WeekEnd" type="hidden" value="16" />
											</cfcase>
											<cfcase value="2">
												<p>每周一次课, 安排2小节</p>
												<input name="TaskPeriod" type="hidden" value="2" />
											</cfcase>
											<cfcase value="3">
												<p>每周一次课, 安排3小节</p>
												<input name="TaskPeriod" type="hidden" value="3" />
											</cfcase>
											<cfcase value="4">
												<p>
													<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="2+2" />
													每周两次课, 每次2小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="4" />
													每周一次课, 连续4小节
												</p>
											</cfcase>
											<cfcase value="5">
												<p>
													<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+2" />每周两次课, 一次2小节,一次3小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="5" />每周一次课, 连续5小节
												</p>
											</cfcase>
											<cfcase value="6">
												<p>
													<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3" />每周两次课, 每次3小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="4+2" />每周两次课, 一次4小节, 一次2小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2" />每周三次课, 每次2小节
												</p>
											</cfcase>
											<cfcase value="8">
												<p>
													<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3+2" />每周三次课, 两次3小节, 一次2小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2+2" />每周四次课, 每次2小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="4+4" />每周两次课, 每次4小节
												</p>
											</cfcase>
											<cfcase value="10">
												<p>
													<input name="TaskPeriod" type="radio" class="typeRadio" checked="checked" value="3+3+2+2" />
													每周四次课, 两次3小节, 两次2小节
													<input name="TaskPeriod" type="radio" class="typeRadio" value="2+2+2+2+2" />
													每周五次课, 每次2小节
												</p>
											</cfcase>
											<cfcase value="16">
												<p>每周四次课, 两次4小节</p>
												<input name="TaskPeriod" type="hidden" value="4+4+4+4" />
											</cfcase>
										</cfswitch>
										<cfif rs_courseEntity.period_week gt 0>
											<cfset howmanyWeeks = round(0.4+rs_courseEntity.period_theory / rs_courseEntity.period_week) />
											<cfset weekArray = [] />
											<div class="secondRow">
												<div class="UIBottonRow">
													<i>课程周次单元</i>
													<cfswitch expression="#howmanyWeeks#">
														<cfcase value="4">
															<cfloop list="1,5,9,13" index="start">
																<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a> 
															</cfloop>
															<!--- 特殊情况 用于春节、国庆时长调整 --->
															<cfif academicTerm eq "1">
																<cfloop list="4,8,12" index="start">
																	<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
																</cfloop>
															</cfif>
														</cfcase>
														<cfcase value="8">
															<cfloop list="1,5,9" index="start">
																<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
															</cfloop>
															<!--- 特殊情况 用于春节、国庆时长调整 --->
															<cfif academicTerm eq "1">
																<cfloop list="4,8" index="start">
																	<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
																</cfloop>
															</cfif>
														</cfcase>
														<cfcase value="10,11,12,14">
															<cfloop list="1,5" index="start">
																<cfset arrayAppend(weekArray, [start, (start+howmanyWeeks-1)]) />
																<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
															</cfloop>
															<!--- 特殊情况 用于春节、国庆时长调整 --->
															<cfif academicTerm eq "1">
																<cfloop list="4" index="start">
																	<a href="javascript:changeWeek(<cfoutput>#start#</cfoutput>,<cfoutput>#(start+howmanyWeeks-1)#</cfoutput>);"><cfoutput>#start#</cfoutput>-<cfoutput>#(start+howmanyWeeks-1)#</cfoutput></a>
																</cfloop>
															</cfif>
														</cfcase>
														<cfcase value="16">
															<cfset arrayAppend(weekArray, [1, 16]) />
															<a href="javascript:changeWeek(1,16);">1-16</a> <a href="javascript:changeWeek(5,19);">5-19</a>
															<!--- 特殊情况 用于春节、国庆时长调整 --->
															<cfif academicTerm eq "1">
																<a href="javascript:changeWeek(4,19);">4-19</a>
															</cfif>
														</cfcase>
														<cfdefaultcase>
															<cfset arrayAppend(weekArray, [1, howmanyWeeks]) />
														</cfdefaultcase>
													</cfswitch>
													<a href="javascript:changeWeekSet(1);">顺延1周</a> <a href="javascript:changeWeekSet(-1);">提前1周</a>
												</div>
											</div>
											<div class="secondRow">
												<cfif arrayLen(weekArray) gt 1>
														<cfset randWeek = weekArray[randRange(1, arrayLen(weekArray))] />
													<cfelse>
														<cfset randWeek = weekArray[1] />
												</cfif>
												起始周
												<input name="WeekStart" id="WeekStart" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#randWeek[1]#</cfoutput>" />
												结束周
												<input name="WeekEnd" id="WeekEnd" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#randWeek[2]#</cfoutput>" />
											</div>
											<script language="javascript" type="text/javascript">
												//<![CDATA[
												<!--
												function changeWeekSet(offset) {
												
													var start = parseInt($("#WeekStart").val()) + offset;
													var end = parseInt($("#WeekEnd").val()) + offset;
											
													if (start > 0 && start < 16) { $("#WeekStart").val(start); }
													if (end < 19 && end > 0) { $("#WeekEnd").val(end); }
													if (end < start) { $("#WeekEnd").val(start); }											
												
													return void(0);
												}
											
												function changeWeek(start, end) {
											
													$("#WeekStart").val(start);
													$("#WeekEnd").val(end);
											
													return void(0);
												}
												// -->
												//]]>
											</script>
										</cfif>
									</div>
									<div class="label">
										<b>主讲教师</b>
										<input name="TeacherName" id="TeacherName" type="text" disabled="disabled" class="typeTextDynamic " verification="required" value="<cfoutput>#event.getArg('TNAME','未指定')#</cfoutput>" /><span id="teacherTrigger" class="btnSearch"></span>
									</div>
									<div class="label">
										<b>排课要求</b>
										<textarea name="Describe" id="Describe"><cfoutput>#event.getArg('Describe')#</cfoutput></textarea>
									</div>
									<hr/>
									<div class="lable">
										<input class="button" type="submit" value="建立教学班" />
									</div>
								</form>
							</div>
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
								function processCreate() {
									
									var teacherID = $("#TeacherID").val();
									var taskCount = parseInt($("#TaskCount").val());
								
									if (teacherID != "") {
									
										if (taskCount <= <cfoutput>#maxTask#</cfoutput>) {
											return processVerfiyForm('formCreate');
										}
										else {
											alert("开班数量超过限制");
											return false;
										}
									
									}
									else {
										alert("请先指定任课教师");
									
										$("#formBox").addClass("hidden_elem");
										$("#teacherBox").removeClass("hidden_elem");
									
										return false;
									}
								}
								$(document).ready(function() {
								
									$("#teacherTrigger").click(function(){

										$("#formBox").addClass("hidden_elem");
										$("#teacherBox").removeClass("hidden_elem");

									});
									
								});
								// -->
								//]]>
							</script>
						</cfif>
						
						
						<cfelse>
						
						<!--- 课程已达到最大运行开设门数 --->
						<div class="noticeBlock">
							<h3>课程安排完毕</h3>
							<p><span class="img icon16x16 message"></span>当前学期该门通选课的所有教学任务已安排完毕</p>
							<ol>
								<li class="friendly"><span class="img icon10x10 browser"></span><a href="<cfoutput>#buildURL('commonTask', {DepID=rs_courseEntity.institute_id})#</cfoutput>">查看任课单位其他课程</a></li>
							</ol>
						</div>
					</cfif>
				</div>
				
				<cfif (rs_taskEntity.recordCount gt 0) and (rs_coursekLockCheck.recordCount eq 0) >

					<div id="TaskDetail" class="tabContent">
					
						<div class="noticeBlock">
							<h3>修改教学任务</h3>
							<hr/>
						</div>
						
						<div id="updateBox">
						
							<form id="formUpdate" onSubmit="javascript:return processVerfiyForm('formUpdate');" class="formWrapper" method="post" action="<cfoutput>#buildURL('commonTaskUpdateDo')#</cfoutput>">
							
								<input name="TaskID" type="hidden" value="<cfoutput>#rs_taskEntity.tsk_id#</cfoutput>" />
								<input id="TeacherIDUpdate" name="TeacherID" type="hidden" value="<cfoutput>#rs_taskEntity.tch_id#</cfoutput>" />
							
								<div class="label">
									<span class="req">*</span><b>计划人数</b>
									<input name="PlanSize" type="text" class="typeSmallInt" verification="integer" maxlength="5" value="<cfoutput>#rs_taskEntity.task_limite#</cfoutput>" />
									<span>实际选课人数 <strong><cfoutput>#rs_taskEntity.task_chooesd#</cfoutput></strong></span>
								</div>
							
								<div class="label">
									<b>周次安排</b>
									<div class="secondRow">
									
										<cfset weekPlan = listToArray(rs_taskEntity.task_week, "-") />
									
										起始周 <input name="WeekStart" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#weekPlan[1]#</cfoutput>" />
										结束周 <input name="WeekEnd" type="text" class="typeTinyInt" verification="integer" maxlength="2" value="<cfoutput>#weekPlan[2]#</cfoutput>" />
										
										周学时 <input name="TaskPeriod" type="text" class="typeSmallInt" verification="required" value="<cfoutput>#rs_taskEntity.task_period#</cfoutput>" />
									
									</div>
								</div>
							
								<div class="label">
									<b>主讲教师</b>
									<input name="TeacherName" id="TeacherNameUpdate" type="text" disabled="disabled" class="typeTextDynamic " verification="required" value="<cfoutput>#rs_taskEntity.tch_name#</cfoutput>(<cfoutput>#rs_taskEntity.tch_id#</cfoutput>)" /><span id="teacherUpdateTrigger" class="btnSearch"></span>
								</div>
							
								<hr/>
							
								<div class="label">
									<b>排课教室类别</b>
									<select name="ClassroomType">
                                        <cfloop query="rs_clsroomType">
											<option <cfif rs_taskEntity.cr_type eq rs_clsroomType.cr_type>selected="selected"</cfif> value="<cfoutput>#rs_clsroomType.cr_type#</cfoutput>"><cfoutput>#rs_clsroomType.cr_type_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
							
								<div class="label">
									<b>上课校区</b>
									<select name="CampusID" >
                                        <cfloop query="rs_campus">
											<option <cfif rs_taskEntity.campus_id eq rs_campus.campus_id>selected="selected"</cfif> value="<cfoutput>#rs_campus.campus_id#</cfoutput>"><cfoutput>#rs_campus.campus_name#</cfoutput></option>
										</cfloop>
									</select>
								</div>
							
								<div class="label">
									<b>排课要求</b>
									<textarea style="height:60px;" name="Describe"><cfoutput>#rs_taskEntity.task_desc#</cfoutput></textarea>
								</div>
							
								<hr/>
							
								<div class="lable">
									<input class="button" type="submit" value="更新教学任务" />
								</div>
							
							</form>
						
							<script language="javascript" type="text/javascript">
								//<![CDATA[
								<!--
							
								$(document).ready(function() {
								
									$("#teacherUpdateTrigger").click(function(){

										$("#updateBox").addClass("hidden_elem");
										$("#teacherBox").removeClass("hidden_elem");

									});
									
								});
								// -->
								//]]>
							</script>
						
						</div>
					</div>
				</cfif>
				
				<div id="teacherBox" class="hidden_elem">
						
					<form id="formSearch" class="formWrapper Transparent" method="post">
						<div class="label">
							<b>教师姓名或职工号</b>
							<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
						</div>
						<hr/>
						<div class="lable">
							<input class="button1" type="submit" value="搜索教师" />
							<input id="formSearchReset" class="button" type="button" value="返回" />
						</div>
					</form>
						
					<div id="formSearchResult" class="UICardTable"></div>
						
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$("input#formSearchReset").click(function(){
						
							$("#formBox").removeClass("hidden_elem");
							$("#teacherBox").addClass("hidden_elem");
								
						});
							
						$("#formSearch").submit(function(){
								
							if (processVerfiyForm('formSearch')) {
							
								$.getJSON(
										'<cfoutput>#buildURL("getTeacherByKeywords")#</cfoutput>',
										{
											'Keywords': $("form#formSearch input#Keywords").val(),
											'seed': (new Date()).getTime()
										},
										function(data) {
												
											$div = $("div#formSearchResult").html("").removeClass("hidden_elem");
											$("form#formAuth").addClass("hidden_elem");
												
											for (var i=0; i<data.length; i++) {
											
												var $element = $("<dl><dt><a><i class='sex" + data[i][2] + "'></i><dd><h3>" + data[i][1] + " [" + data[i][3] + "]" + "</h3><p>(" + data[i][0] + ")</p></dd></a></dt></dl>");
													
												$element
													.attr({
														'TeacherID' : data[i][0],
														'TeacherName' : data[i][1]
													})
													.click(function(){
															
														var name = $(this).attr('TeacherName');
														var id = $(this).attr('TeacherID');
															
														$("form#formCreate input#TeacherID").val(id);
														$("form#formCreate input#TeacherName").val(name + "(" + id + ")");
														
														$("form#formUpdate input#TeacherIDUpdate").val(id);
														$("form#formUpdate input#TeacherNameUpdate").val(name + "(" + id + ")");
															
														/* backForm */
														$("#formBox").removeClass("hidden_elem");
														$("#updateBox").removeClass("hidden_elem");
														$("#teacherBox").addClass("hidden_elem");
														
													})
													.appendTo($div);
													
											}
												
										});
								
							}
						
							return false;
						});
							
						// -->
						//]]>
					</script>
						
				</div>
				
			</div>
		</li>
	</ul>
</div>

